package com.happy.xiao.common.rabbitmq.service;

import com.happy.xiao.common.rabbitmq.bean.MessageReliabilityDelay;

public interface IReliabilityMessage {

    /**
     * 发送 保证消息可靠性的消息
     *
     * @param message 消息内容
     */
    boolean sendReliabilityConfirmMessage(String message) throws Exception;

    /**
     * 发送检查消息【可靠性检查】
     *
     * @param object
     * @return
     * @throws Exception
     */
    boolean sendReliabilityCheckDelayMessage(MessageReliabilityDelay object) throws Exception;

    /**
     * 发送检查消息【可靠性检查】
     *
     * @param object
     * @return
     * @throws Exception
     */
    boolean sendReliabilityCheckDelayMessage(MessageReliabilityDelay object, long times) throws Exception;


    // TODO ------------------------------------------------------------------------------------------------------------
    // TODO -------------------------------------------可靠性消息发送-----------------------------------------------------
    // TODO ------------------------------------------------------------------------------------------------------------

    /**
     * 发送可靠性的普通消息
     *
     * @param exchange
     * @param routingKey
     * @param message
     * @param callbackUrl
     * @return
     * @throws Exception
     */
    boolean sendReliabilityNormalMessage(String exchange,
                                         String routingKey,
                                         String message,
                                         String callbackUrl) throws Exception;

    /**
     * 发送可靠性【普通消息】
     *
     * @param exchange
     * @param routingKey
     * @param message
     * @param callbackUrl
     * @param reliabilityTimes       毫秒
     * @return
     * @throws Exception
     */
    boolean sendReliabilityNormalMessage(String exchange,
                                         String routingKey,
                                         String message,
                                         String callbackUrl,
                                         long reliabilityTimes) throws Exception;


    /**
     * 发送可靠性【延时消息】
     *
     * @param exchange
     * @param routingKey
     * @param message
     * @param callbackUrl
     * @return
     * @throws Exception
     */
    boolean sendReliabilityDelayMessage(String exchange,
                                        String routingKey,
                                        String message,
                                        String callbackUrl,
                                        long delayTimes) throws Exception;


    /**
     * 发送可靠性【延时消息】
     *
     * @param exchange
     * @param routingKey
     * @param message
     * @param callbackUrl
     * @param delayTimes            延时的消息/毫秒
     * @param reliabilityTimes      可靠性消息/毫秒     0的话就使用默认的延迟处理时间
     * @return
     * @throws Exception
     */
    boolean sendReliabilityDelayMessage(String exchange,
                                        String routingKey,
                                        String message,
                                        String callbackUrl,
                                        long delayTimes,
                                        long reliabilityTimes) throws Exception;
}
